#include "FpsCounter.h"

// --------------------------------------------// 

FpsCounter::FpsCounter( float updateInterval )
: m_fps( 0.0f )
, m_timeSinceLastUpdate( 0.0f )
, m_fpsUpdateInterval( updateInterval )
, m_numberOfFrames( 0 )
{

}

// --------------------------------------------// 

void FpsCounter::Update( float delta )
{
	m_numberOfFrames++;
	m_timeSinceLastUpdate += delta;

	if ( m_timeSinceLastUpdate >= m_fpsUpdateInterval )
	{
		m_fps = (float)m_numberOfFrames / m_timeSinceLastUpdate;
		m_numberOfFrames = 0;
		m_timeSinceLastUpdate = 0;//-= m_fpsUpdateInterval;
	}	
}


